// Check xem trình duyệt là IE6 hay IE7
var isIE		= (navigator.userAgent.toLowerCase().indexOf("msie") == -1 ? false : true);
var isIE6	= (navigator.userAgent.toLowerCase().indexOf("msie 6") == -1 ? false : true);
var isIE7	= (navigator.userAgent.toLowerCase().indexOf("msie 7") == -1 ? false : true);
var isChrome= (navigator.userAgent.toLowerCase().indexOf("chrome") == -1 ? false : true);
strTooltipProductOb= (typeof(strTooltipProductOb) == "undefined" ? ".list pre,.no_bor_content pre," : strTooltipProductOb + ".list pre,.no_bor_content pre,");
function tooltipProduct(ob){
    if(isIE6 || isIE7) return;
    /*
	var obj = ".product_realtime_list_home  pre, .list_product pre, .view_list_table pre, .view_collapse_table pre,"
				 + " .compare_table pre, .suggestion_content pre, .upload_gallery pre, .other_estore_product_exclusive_table pre,"
				 + " .show_cart_table pre, .product_follow pre, .product_table_template pre";
	if(typeof(ob) != "undefined") obj = ob;
	*/
    // Nếu có khai báo ob thì gán luôn cho strTooltipProductOb
    if(typeof(ob) != "undefined") strTooltipProductOb = ob;
    // Nếu ko tồn tại strTooltipProductOb thì return luôn
    if(typeof(strTooltipProductOb) == "undefined") return;
    // Bẻ ra array
    arrTooltipProductOb	= strTooltipProductOb.split(",");
    // Lấy array unique
    arrTooltipProductOb	= $.unique(arrTooltipProductOb);
    // Lấy obj để đưa vào jquery
    obj	= "";
    $.each(arrTooltipProductOb, function(index, value){
        if(obj != "") obj += ",";
        obj += $.trim(value);
    });
    $(obj).each(function(index, domEle){
        var obTT	= $(domEle).parent().find(".tooltip");
        var img	= $(domEle).parent().find(".tooltip img");
        obTT.tooltip({
            bodyHandler: function(){
                tooltipWidth	= (typeof(obTT.attr("tooltipWidth")) != "undefined" ? obTT.attr("tooltipWidth") : 350);
                $("#tooltip").css("width", tooltipWidth + "px");
                //				$(domEle).find(".picture, .picture_only").html(function(index, html){
                //					width			= (typeof($(this).attr("width"))	!= "undefined" ? $(this).attr("width") : img.width());
                //					height		= (typeof($(this).attr("height"))!= "undefined" ? $(this).attr("height") : img.height());
                //					maxWidth		= (typeof($(this).attr("maxWidth"))	!= "undefined" ? $(this).attr("maxWidth") : 350);
                //					maxHeight	= (typeof($(this).attr("maxHeight"))!= "undefined" ? $(this).attr("maxHeight") : 350);
                //					arrFixSize	= fixImageSize(width, height, maxWidth, maxHeight);
                //					return '<img width="' + arrFixSize[0] + '" height="' + arrFixSize[1] + '" src="' + $(this).attr("src") + '" />';
                //				});
                return $(domEle).html();
            },
            track: true,
            showURL: false,
            extraClass: "tooltip_product"
        });
    });
}

function loadImageTooltip(){
    $("pre img").each(function(index){
        this.src = this.title;
    });
}

